# $Id$
# Maintainer:  J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=libaacs
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.10.0
pkgrel=1
pkgdesc="Advanced Access Content System (mingw-w64)"
arch=('any')
license=('LGPL')
url="https://www.videolan.org/developers/libaacs.html"
depends=("${MINGW_PACKAGE_PREFIX}-libgcrypt")
source=("https://download.videolan.org/pub/videolan/${_realname}/${pkgver}/${_realname}-${pkgver}.tar.bz2")
sha256sums=('93f6b19ef71e6f73e77bd7535946c09c45330e9b42e832a63a1d6b042f6b12fe')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  ./bootstrap
}

build() {
  cd "$srcdir"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
  install -Dm644 "$srcdir"/${_realname}-${pkgver}/KEYDB.cfg "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"/KEYDB.cfg
  install -Dm644 "$srcdir"/${_realname}-${pkgver}/README.txt "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"/README.txt
}
